unit FCalculo_mm_Inc;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls, Mask, DBCtrls, Math;

type
  TFormCalculo_mm_Inc = class(TForm)
    Label1: TLabel;
    Panel1: TPanel;
    Panel2: TPanel;
    Label2: TLabel;
    Label3: TLabel;
    eAnchoMM: TDBEdit;
    BtnSalir: TSpeedButton;
    eAltoMM: TDBEdit;
    BtnAnchoMM_Pulg: TSpeedButton;
    BtnAnchoPulg_MM: TSpeedButton;
    BtnAltoMM_Pulg: TSpeedButton;
    BtnAltoPulg_MM: TSpeedButton;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Panel3: TPanel;
    Panel4: TPanel;
    eAnchoInc: TEdit;
    eAltoInc: TEdit;
    procedure BtnAnchoMM_PulgClick(Sender: TObject);
    procedure BtnAnchoPulg_MMClick(Sender: TObject);
    procedure BtnAltoMM_PulgClick(Sender: TObject);
    procedure BtnAltoPulg_MMClick(Sender: TObject);
    procedure BtnSalirClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormCalculo_mm_Inc: TFormCalculo_mm_Inc;

implementation

uses
  ModDatos;

{$R *.dfm}

procedure TFormCalculo_mm_Inc.BtnAltoMM_PulgClick(Sender: TObject);
begin
  eAltoInc.SetFocus;
  if not md.TPresupuestos.FieldByName( 'IMPRESO_ALTO').IsNull then eAltoInc.Text := FloatToStr( RoundTo( md.TPresupuestos.FieldByName( 'IMPRESO_ALTO').AsFloat / 25.4, -3));
end;

procedure TFormCalculo_mm_Inc.BtnAltoPulg_MMClick(Sender: TObject);
begin
  eAltoMM.SetFocus;
  if eAltoInc.Text <> '' then md.TPresupuestos.FieldByName( 'IMPRESO_ALTO').AsInteger := Round( StrToFloat( eAltoInc.Text) * 25.4);
end;

procedure TFormCalculo_mm_Inc.BtnAnchoMM_PulgClick(Sender: TObject);
begin
  eAnchoInc.SetFocus;
  if not md.TPresupuestos.FieldByName( 'IMPRESO_ANCHO').IsNull then eAnchoInc.Text := FloatToStr( RoundTo( md.TPresupuestos.FieldByName( 'IMPRESO_ANCHO').AsFloat / 25.4, -3));
end;

procedure TFormCalculo_mm_Inc.BtnAnchoPulg_MMClick(Sender: TObject);
begin
  eAnchoMM.SetFocus;
  if eAnchoInc.Text <> '' then md.TPresupuestos.FieldByName( 'IMPRESO_ANCHO').AsInteger := Round( StrToFloat( eAnchoInc.Text) * 25.4);
end;

procedure TFormCalculo_mm_Inc.BtnSalirClick(Sender: TObject);
begin
  Close;
end;

end.
